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