UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y/Lfwfka7dE5Do6jp3Km21SlwxjNvjP0MCCnLGgQFP4='
WHERE
key_id = '677a9f001307c53ea6a847a47e2a6c6a2ac94d60bbd562fe63f5c0a24fc9e670'
AND (
token = 'Y/Lfwfka7dE5Do6jp3Km21SlwxjNvjP0MCCnLGgQFP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)