UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fSyY9g6YPcPEDzG3cdb1Adt3Bykb6uikZ2mqT4J4qSw='
WHERE
key_id = '14e3c5999034f91cee36f7644e917ed9c65c7e172636166de42cdbec71a24f42'
AND (
token = 'fSyY9g6YPcPEDzG3cdb1Adt3Bykb6uikZ2mqT4J4qSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)