UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hKDgcC08mojqJtsH4Up255vHcquu+dCqoiXaa1205vY=' 
WHERE 
  key_id = '2bbf44059643a71044f07f2e528b3a96af19f41e841455c0d7c060771b26fbc9' 
  AND (
    token = 'hKDgcC08mojqJtsH4Up255vHcquu+dCqoiXaa1205vY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029