UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z5ZSYqqK5udUqufzYFUlduGdbaK84IK8gh1tTiIEcZE=' 
WHERE 
  key_id = '820d6e77b0ae34c347f2e2999cd45f298f4e267f03a3388e38d3adc007c7b353' 
  AND (
    token = 'z5ZSYqqK5udUqufzYFUlduGdbaK84IK8gh1tTiIEcZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027