UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gU1PZX3M1M1vOUtOOyGHBSv+V1CW0rIQDAMiQNZYDoM=' 
WHERE 
  key_id = '8aae0223ca53a3d10b93a71ac97dc38e77be4275b7189787d4880249fe829691' 
  AND (
    token = 'gU1PZX3M1M1vOUtOOyGHBSv+V1CW0rIQDAMiQNZYDoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022