UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8xCLgv5iHmFT4gKd+qJaA9Ryjw8o8QsdyQXXJrF/txw='
WHERE
key_id = 'be7fc9e6b1654240c1d657c38d13b800d47634ea64453b0e1bf50a9ff8919fc9'
AND (
token = '8xCLgv5iHmFT4gKd+qJaA9Ryjw8o8QsdyQXXJrF/txw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)