UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8njpmSPRLKcFTL/z4kazeXnUEtkizP0wIClnfgWufNw=' 
WHERE 
  key_id = '262977074a94c4f480e9a64fed60e704399b7044f68c5dd943edc60389e42924' 
  AND (
    token = '8njpmSPRLKcFTL/z4kazeXnUEtkizP0wIClnfgWufNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027