UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5QeksOYQZSlVBrFP8nEmWuJ6i/vFkqVwUGVyoqa8T+0='
WHERE
key_id = 'c499e29bd81848c135b60ba941211dcd8d5cdbe70603292b5534d7a2346fc142'
AND (
token = '5QeksOYQZSlVBrFP8nEmWuJ6i/vFkqVwUGVyoqa8T+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)