UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wM4jy7tWCobJUNIZxTo+2DIhHUD11+/ebPQM+VNNqRw='
WHERE
key_id = '3517c69412ca9f85c7833ec046e0cff1236ee6f0bdc274705c811e5c0224a4cc'
AND (
token = 'wM4jy7tWCobJUNIZxTo+2DIhHUD11+/ebPQM+VNNqRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)