UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z1RHaYl+HFhd2ItaThuDhHu71+3VKHYAiy1USecisto=' 
WHERE 
  key_id = 'b77482f62d90dcce60f9583e9cd2a41d99a8af0e858805c8d6daf23d724aa7c4' 
  AND (
    token = 'Z1RHaYl+HFhd2ItaThuDhHu71+3VKHYAiy1USecisto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069