UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FgRIRyyHtJMl9HcZWTWOdedKeE6G54EtfgZFS2VwVko='
WHERE
key_id = '78872c9979e062538f53cc5f1016a67b36f130b3df849e53f4f22ebee5a44bcb'
AND (
token = 'FgRIRyyHtJMl9HcZWTWOdedKeE6G54EtfgZFS2VwVko='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)