UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a97VMixk1AJXPaaLkTRfBse3XswFgAj4V6K9J0LbcBE='
WHERE
key_id = '80d7bff1f869be2c1eb324ab91fd09554e2f2c776b4edd45f58fa56c2f242641'
AND (
token = 'a97VMixk1AJXPaaLkTRfBse3XswFgAj4V6K9J0LbcBE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)