UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TW422fNfIb0iSHiHw0mkt0NoMuNk8ralL9Gqof4SDsc='
WHERE
key_id = '25ea1a436f5d966df3bb7cf121b5b6c6f7d3f6f042358009d426eea82bc1f28a'
AND (
token = 'TW422fNfIb0iSHiHw0mkt0NoMuNk8ralL9Gqof4SDsc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)