UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BqtkGb/yqyjdh6walpjC+XGS31IK4pmWVgbVdvnbgT8=' 
WHERE 
  key_id = '2f98c5ef70edc3d448fa7a62ecca467bf197d54ea85661093057ac17d0f9b083' 
  AND (
    token = 'BqtkGb/yqyjdh6walpjC+XGS31IK4pmWVgbVdvnbgT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022