UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZESLIr6vQWwH9+cQF9DECneIE0f9BvyMhwrKcafXnjs='
WHERE
key_id = 'aa9a2da7bfd68a8698b966bb7586d7daf3776988985472f65da14651cdb3edbd'
AND (
token = 'ZESLIr6vQWwH9+cQF9DECneIE0f9BvyMhwrKcafXnjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)