UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GAupive7400G+OL4iR7AquTWzTgtQRkHQNn2hvqhaY4=' 
WHERE 
  key_id = '763933f140f918136d6d19a084094c01c3e01274c252487e0fd14ca02f909da7' 
  AND (
    token = 'GAupive7400G+OL4iR7AquTWzTgtQRkHQNn2hvqhaY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049