UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WKsoYze0rbVweSQywXvRnZlkTGCpi098b+UX4f+FaHg=' 
WHERE 
  key_id = 'b40cb29bbf9c00049c7bd0e08545e4bebfe45d5be71006c7035a4b16acf95988' 
  AND (
    token = 'WKsoYze0rbVweSQywXvRnZlkTGCpi098b+UX4f+FaHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037