UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qNxZtT7GZr8wZ0fs/8Xeb5MG9rE21UzgaLIMTVa4e90='
WHERE
key_id = '00314b77ae008c8b18ea96997bec5ac8f6aba5af4400103ccbfbd50883f7367a'
AND (
token = 'qNxZtT7GZr8wZ0fs/8Xeb5MG9rE21UzgaLIMTVa4e90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)