UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J6BmAe5r8Einsye7ae3YJQWoduuvrKfd2cpZgEX7GIE='
WHERE
key_id = 'be7b1e7ba676fc41379d726f0fb5e5f6a94b0caaa7f27c61b2653da51d07039e'
AND (
token = 'J6BmAe5r8Einsye7ae3YJQWoduuvrKfd2cpZgEX7GIE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)