UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zX9qtp4m6js3lZvhqf0JcIpY9k930AUkvj3B+ubr9L4='
WHERE
key_id = 'fc1f3fad64f50356b5152dffbc241ef4252c5531d363c5399aa03e6e02af7767'
AND (
token = 'zX9qtp4m6js3lZvhqf0JcIpY9k930AUkvj3B+ubr9L4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)