UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dDPRs5QvAzwTXgYjQ79kp17HkWgkHIWxnJklmP6fdws='
WHERE
key_id = '5295a06b5fa2b1b30c82ea317578a0b4932ab0585f370439228bcb1f41c2e2fd'
AND (
token = 'dDPRs5QvAzwTXgYjQ79kp17HkWgkHIWxnJklmP6fdws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)