UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k+I0PrtNjI8pjOJbUiXws1KJ7EezYguEw8JbwbXc5EA='
WHERE
key_id = 'e2d09cfae078e9ea760af9a78e9acecefbf703eac9e4c3e0874cdf61d281a528'
AND (
token = 'k+I0PrtNjI8pjOJbUiXws1KJ7EezYguEw8JbwbXc5EA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)