UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F/74XAWNb5klrnMwR04wwmYUw8lTbhFcG+1Ktcn7Fjw='
WHERE
key_id = 'f1dc0aeea0120da98ea727bc9319dd67f9b7db946d66b3c30f822152bc450b5b'
AND (
token = 'F/74XAWNb5klrnMwR04wwmYUw8lTbhFcG+1Ktcn7Fjw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)