UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qi9jRBL0w/0NmlvEkCN9OzZ0Hylag2bfM/2h2qAERc0=' 
WHERE 
  key_id = '4ccf2da80e2172b17bf3e3e5e5848ee6c61c3dea183ffbce701fa665660ff221' 
  AND (
    token = 'qi9jRBL0w/0NmlvEkCN9OzZ0Hylag2bfM/2h2qAERc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018