UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xakNpx7VAZQuFsDvhFHyJ5MTGUoLAcEDKD7Y2BGIvow='
WHERE
key_id = 'fc1cf0b9b715b973ef60a1acb84085ac396cca1e63f86217d4c2471fec7b0c78'
AND (
token = 'xakNpx7VAZQuFsDvhFHyJ5MTGUoLAcEDKD7Y2BGIvow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)