UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tPGXrwY/gSeIcIOs0P2bo7bvHyxl89peL+RZqTHfV/k='
WHERE
key_id = '3f0c59dc5c4db0fabba43a3c18ca2c10929ad97b64c258356b8ce61781752288'
AND (
token = 'tPGXrwY/gSeIcIOs0P2bo7bvHyxl89peL+RZqTHfV/k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)