UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uvAzJz0FG35gx2wrWm97+hAUxonJYlaLUGXMhqI+nLY=' 
WHERE 
  key_id = 'd8604aa7c5f5799424a5a0294032985f38467a6b2c1bd01d16ebdc799ba4613a' 
  AND (
    token = 'uvAzJz0FG35gx2wrWm97+hAUxonJYlaLUGXMhqI+nLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039