UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/8K+og29UUvvX6SW79lcWrbaTqrWpKgt2d69e88fYNc=' 
WHERE 
  key_id = 'd26644a5d41374df8b9f0333dccdc365b86d69f170c548e30990cd1848c0c8a7' 
  AND (
    token = '/8K+og29UUvvX6SW79lcWrbaTqrWpKgt2d69e88fYNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050