UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iNFE4EO/dsQBh1iCFI153f++W66ITtj0GrzP+Fuyz7E=' 
WHERE 
  key_id = 'c001ba65ee86a08ccac2cf945005589a8bb828bc1790849671ee685cff80b970' 
  AND (
    token = 'iNFE4EO/dsQBh1iCFI153f++W66ITtj0GrzP+Fuyz7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053