UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2IN2KZHejbzLBbYbS6/YfsCpY8SlSJ+uWa38Q1XP6bc=' 
WHERE 
  key_id = '81f29d07de7b62fb0280b7a4ff009a954aa807c0953d892aa7b9b0d4e993be17' 
  AND (
    token = '2IN2KZHejbzLBbYbS6/YfsCpY8SlSJ+uWa38Q1XP6bc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042