UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MNNxGfwYyy9WCnAEuCZWEcOk1R5wGPndzIw7qFVOc0M=' 
WHERE 
  key_id = '9f3683df1bfd5308b79a32af70971744f699f18c98b7544a1b43168b84ee97c3' 
  AND (
    token = 'MNNxGfwYyy9WCnAEuCZWEcOk1R5wGPndzIw7qFVOc0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016