UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KcnlX6oSfS1qIdnjeiJWiabDl15wWAD+CHzjw/uAiVs='
WHERE
key_id = '65acaad0d82d2809c053bba9c2e69823fe6f9523fd222d3d9d2c96af848fb139'
AND (
token = 'KcnlX6oSfS1qIdnjeiJWiabDl15wWAD+CHzjw/uAiVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)