UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gE4ZLxiXfyiqybe7oefSGl5axfSny1iaPi05BMqGQD0='
WHERE
key_id = '7eb559d519ceaff331884f44ff25c76f09795c5636397a544c2eadc2c91f0d50'
AND (
token = 'gE4ZLxiXfyiqybe7oefSGl5axfSny1iaPi05BMqGQD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)