UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y5M12NiYQCPGHAiLiBL4oEqRBJnWdO27hhkY1kfeLSI='
WHERE
key_id = '9c67570eff571750a06545c68dee48fdc23951432120b1392840a13add8ed81b'
AND (
token = 'Y5M12NiYQCPGHAiLiBL4oEqRBJnWdO27hhkY1kfeLSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)