UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AWfSnXTYTRCWNjvTsl+fP/14UOoqUKDR0fozNDs20GU='
WHERE
key_id = 'a8f3f50a0c13e760e010811587261642c3fa7b6c16d68fe22ef2026ac9013ebc'
AND (
token = 'AWfSnXTYTRCWNjvTsl+fP/14UOoqUKDR0fozNDs20GU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)