UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TXrrLqSkKpFRF5gID9cCBDG/Bp7uRexBu9yelaMgP0U='
WHERE
key_id = '7b59c3631aea2f82c69e6f6369c01be6a838ddeb2f8a7307443e7d4a0722b504'
AND (
token = 'TXrrLqSkKpFRF5gID9cCBDG/Bp7uRexBu9yelaMgP0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)