UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ihHmOcrT7MrfKPQZRTHd7vlE7WUEaump3lGWfzhjJL0='
WHERE
key_id = '4482709ec8fb800bfca3748f22e49494cdc5f8f7e4ae41ef1c65df0a4d2cacb6'
AND (
token = 'ihHmOcrT7MrfKPQZRTHd7vlE7WUEaump3lGWfzhjJL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)