UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k4Y246DUg+HoUQC2Gf0PwQPzTx70gCzknYbc9j5HokY='
WHERE
key_id = 'c2fe683f7213f7f2b6e116c8ffc25ae95f3b996565d6320a770533f4e3c52044'
AND (
token = 'k4Y246DUg+HoUQC2Gf0PwQPzTx70gCzknYbc9j5HokY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)