UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ATr4xcge39ohg2jfiSD9hzRJjOBkb5detBGMwW4Z6mU=' 
WHERE 
  key_id = '92aab5defec177d33ee18a32937a65f4cefdda5b0d0c2f26738960be792b9a58' 
  AND (
    token = 'ATr4xcge39ohg2jfiSD9hzRJjOBkb5detBGMwW4Z6mU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036