UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QgWGPPeSgeebIRYp7var7+3Oms8lg4Kp4sX2GHeM/vU='
WHERE
key_id = '9caef55159d56f5e60920a4d7afe4212414a246f36d39c179f35077dc24fe017'
AND (
token = 'QgWGPPeSgeebIRYp7var7+3Oms8lg4Kp4sX2GHeM/vU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)