UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QPiB+6ErUaxztDxPn0oEJtwOE9uhNQjYISPC5jtyQpw='
WHERE
key_id = 'b225ce7bdba023163c1948a01030e16fea50419ae74b23177b33b3f15812c093'
AND (
token = 'QPiB+6ErUaxztDxPn0oEJtwOE9uhNQjYISPC5jtyQpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)