UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1hmEeimcuapPGQ3GHLXH8uDoFOl3C90G2jaUnfP1YXI='
WHERE
key_id = '8f67c694a75f90fff9c543b9c5c2c456d2c6aa37233d2132d8cb37a211b1b51c'
AND (
token = '1hmEeimcuapPGQ3GHLXH8uDoFOl3C90G2jaUnfP1YXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)