UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eSx+KeIcBYnQFr0SZsEdlXHPUDN8YbaD1UgMzdymTJE='
WHERE
key_id = 'd9ce96469398fd783f087d201e6dc30b67f3b8d7f13ad85b0acf4189e524fa4d'
AND (
token = 'eSx+KeIcBYnQFr0SZsEdlXHPUDN8YbaD1UgMzdymTJE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)